package com.fary.condition;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class ConfigurationConditionApplication {

    private static void loadContextAndVerifyBeans(Class... classToRegistry) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
        context.register(classToRegistry);
        context.refresh();
        System.out.println("Has BeanA? " + context.containsBean("beanA"));
        System.out.println("Has BeanB? " + context.containsBean("beanB"));
    }


    public static void main(String[] args) {
        loadContextAndVerifyBeans(BeanA.class);
        loadContextAndVerifyBeans(BeanA.class, BeanB.class);
        loadContextAndVerifyBeans(BeanB.class);
        loadContextAndVerifyBeans(BeanB.class, BeanA.class);
    }
}
 

 
